package com.immunology.database.transformers;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.apache.log4j.Logger;

import com.immunology.core.BaseTransformer;
import com.immunology.database.DbColumns;
import com.immunology.model.Survey;

public class SurveyTransformer extends BaseTransformer<Survey> {
	private static final Logger LOG = Logger
			.getLogger(ComplaintTransformer.class);

	@Override
	public Survey transformTo(ResultSet resultSet) {
		Survey survey = new Survey();
		try {
			survey.setId(resultSet.getInt(DbColumns.FIRST_COLUMN));
			survey.setDoctorId(resultSet.getInt(DbColumns.SECOND_COLUMN));
			survey.setDate(resultSet.getDate(DbColumns.THIRD_COLUMN));
			survey.setMedicineCardId(resultSet.getInt(DbColumns.FOURTH_COLUMN));
			survey.setDifficultyDegree(resultSet.getInt(DbColumns.FIFTH_COLUMN));
			survey.setInsufficiencyDegree(resultSet.getInt(DbColumns.SIXTH_COLUMN));
		} catch (SQLException e) {
			LOG.error("Can't create SurveyTransformer object:", e);
		}
		return survey;
	}

}
